package com.atguigu.gulimall.product.web;

import com.atguigu.gulimall.product.service.SkuInfoService;
import com.atguigu.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Classname ItemController
 * @Description TODO
 * @Date 2021/9/9 13:20
 * @Author Anonymous
 */
@SuppressWarnings("all")
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;
    /**
     * 展示当前sku的详情
     */
    @RequestMapping("/{skuId}.html")
    public String jumpToDetailsPage(@PathVariable("skuId") Long skuId, Model model) {
        SkuItemVo itemVo = skuInfoService.item(skuId);
        model.addAttribute("item",itemVo);
        return "items";
    }
}
